package com.smart.campus.school.service.impl;

import java.util.List;
import com.smart.campus.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smart.campus.school.mapper.MsgMapper;
import com.smart.campus.school.domain.Msg;
import com.smart.campus.school.service.IMsgService;
import com.smart.campus.common.core.text.Convert;

/**
 * 消息Service业务层处理
 * 
 * @author Zhihe.Li
 * @date 2020-06-16
 */
@Service
public class MsgServiceImpl implements IMsgService 
{
    @Autowired
    private MsgMapper msgMapper;

    /**
     * 查询消息
     * 
     * @param id 消息ID
     * @return 消息
     */
    @Override
    public Msg selectMsgById(Long id)
    {
        return msgMapper.selectMsgById(id);
    }

    /**
     * 查询消息列表
     * 
     * @param msg 消息
     * @return 消息
     */
    @Override
    public List<Msg> selectMsgList(Msg msg)
    {
        return msgMapper.selectMsgList(msg);
    }

    /**
     * 新增消息
     * 
     * @param msg 消息
     * @return 结果
     */
    @Override
    public int insertMsg(Msg msg)
    {
        msg.setCreateTime(DateUtils.getNowDate());
        return msgMapper.insertMsg(msg);
    }

    /**
     * 修改消息
     * 
     * @param msg 消息
     * @return 结果
     */
    @Override
    public int updateMsg(Msg msg)
    {
        return msgMapper.updateMsg(msg);
    }

    /**
     * 删除消息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMsgByIds(String ids)
    {
        return msgMapper.deleteMsgByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除消息信息
     * 
     * @param id 消息ID
     * @return 结果
     */
    @Override
    public int deleteMsgById(Long id)
    {
        return msgMapper.deleteMsgById(id);
    }
}
